package org.zk.dubbo_consumer.util;

import org.springframework.stereotype.Component;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@Component
public class YjlMapIntert {
    public Map into(String datemin, String datemax) throws ParseException {
        Map<String,Object> map = new HashMap<>();

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Calendar calendar = new GregorianCalendar();
        //如果首部时间为空，使其为"1997-01-01"
  /*      if (datemin.equals("--")){
            datemin="1997-01-01";
        }*/
        //如果尾部时间为空，使其为当前时间
/*        if (datemax.equals("--")){
            datemax=sdf.format(new Date());
        }*/
        //当前时间加一天
        if (datemax.equals(sdf.format(new Date()))){
            calendar.setTime(sdf.parse(datemax));
            calendar.add(calendar.DATE,1);
            Date date =calendar.getTime();
            datemax = sdf.format(date);
        }

        System.out.println(datemin);
        System.out.println(datemax);


        return map;
    }
}
